import request from '@/utils/request'

const orderApi = {
  // 订单统计
  getOrderStatList: (params) => {
    return request({
      url: '/trade/order/get-order-count',
      method: 'GET',
      params
    })
  },
  // 自营订单列表
  getSelfOrderList: (params) => {
    return request({
      url: '/trade/order/page',
      method: 'GET',
      params
    })
  },
  // 直供订单列表
  getSupplyOrderList: (params) => {
    return request({
      url: '/trade/order/allPage',
      method: 'GET',
      params
    })
  },
  // 订单详情
  getOrderDetail: (id) => {
    return request({
      url: `/trade/order/get-detail?id=${id}`,
      method: 'GET'
    })
  },
  // 快递公司列表
  getDeliveryList: () => {
    return request({
      url: '/trade/delivery/express/list-all-simple',
      method: 'GET'
    })
  },
  // 确认发货
  submitDelivery: (data) => {
    return request({
      url: '/trade/order/delivery',
      method: 'PUT',
      data
    })
  },
  // 获取订单开票抬头信息
  getOrderInvoiceTitle: (titleId) => {
    return request({
      url: `/member/invoice-title/API/get?id=${titleId}`,
      method: 'GET'
    })
  },
  // 获取订单已开发票信息
  getOrderInvoiceDetail: (orderId) => {
    return request({
      url: `/trade/orderInvoice/api/getByOrderId?orderId=${orderId}`,
      method: 'GET'
    })
  },
  // 开具订单发票
  addOrderInvoice: (data) => {
    return request({
      url: '/trade/orderInvoice/api/add',
      method: 'PUT',
      data
    })
  },
  // 供应商订单列表
  getSupplierOrderList: (params) => {
    return request({
      url: `/trade/order/page?pageNo=${params.pageNo}&pageSize=${params.pageSize}&supplierId=${params.companyId}&status=${params.status}`,
      method: 'GET'
    })
  },
  // 采购方订单列表
  getPurchaserOrderList: (params) => {
    return request({
      url: `/trade/order/cgspage?pageNo=${params.pageNo}&pageSize=${params.pageSize}&purchaserId=${params.companyId}&status=${params.status}`,
      method: 'GET'
    })
  },
  // 获取订单物流信息
  getOrderLogistics: (id) => {
    return request({
      url: `/trade/order/maptrack?id=${id}`,
      hideErrorMessage: true,
      method: 'GET'
    })
  },
  recognitionWldhPath: (image) => {
    return request({
			url: `/copm/sjddbApi/getWldh?wldhPath=${image}`,
			method: 'POST',
		})
  }
}
export default orderApi